﻿#include "C3fdReportData.h"

namespace Common
{
	QList<BladeRowData> C3fdReportData::getMeshModel() { return m_MeshModel; }
	void C3fdReportData::setMeshModel(QList<BladeRowData> data)
	{
		m_MeshModel = data;
	}
	void C3fdReportData::addBladeRowData(BladeRowData data) {
		bool isContain = false;
		for (int i = 0; i < m_MeshModel.size(); ++i)
		{
			if (m_MeshModel.at(i).name == data.name) {
				m_MeshModel.replace(i, data);
				isContain = true;
				break;
			}
		}
		if (!isContain) {
			m_MeshModel.push_back(data);
		}
	}
	void C3fdReportData::addBladeRowData(QString name, int bladeNum, double gap, int meshNum)
	{
		bool isContain = false;
		for (int i = 0; i < m_MeshModel.size(); ++i)
		{
			if (m_MeshModel.at(i).name == name) {
				m_MeshModel[i].gap = gap;
				m_MeshModel[i].numOfBlade = bladeNum;
				m_MeshModel[i].numOfMesh = meshNum;
				isContain = true;
				break;
			}
		}
		if (!isContain) {
			BladeRowData data;
			data.name = name;
			data.numOfBlade = bladeNum;
			data.gap = gap;
			data.numOfMesh = meshNum;
			m_MeshModel.push_back(data);
		}
	}
	bool C3fdReportData::updateBladeRowMeshNum(QList<int> nums)
	{
		if (nums.size() != m_MeshModel.size()) {
			return false;
		}
		for (int i = 0; i < nums.size(); ++i)
		{
			m_MeshModel[i].numOfMesh = nums.at(i);
		}
		return true;
	}
	BoundaryData C3fdReportData::getBoundaryModel() { return m_BoundaryModel; }
	void C3fdReportData::setBoundaryModel(BoundaryData data) { m_BoundaryModel = data; }
	void C3fdReportData::setBoundaryModel(double inletPress, double inletTemp, double outletPress, double rotateSpeed)
	{
		m_BoundaryModel.inletPressure = inletPress;
		m_BoundaryModel.inletTemperature = inletTemp;
		m_BoundaryModel.outletPressure = outletPress;
		m_BoundaryModel.rotationSpeed = rotateSpeed;
	}
	QList<PerformanceDataList> C3fdReportData::getPerformanceDatas() { return m_PerformanceDatas; }
	void C3fdReportData::setPerformanceDatas(QList<PerformanceDataList> data)
	{
		m_PerformanceDatas = data;
	}
	void C3fdReportData::addPerformanceData(PerformanceDataList data) { m_PerformanceDatas.push_back(data); }
	void C3fdReportData::addPerformanceData(QString name, double speed, QList<PerformanceData> datas) {
		PerformanceDataList data;
		data.name = name;
		data.rotationSpeed = speed;
		data.datas = datas;
		m_PerformanceDatas.push_back(data);
	}
	QList<PerformanceImage> C3fdReportData::getPerformanceImages() { return m_PerformanceImages; }
	void C3fdReportData::setPerformanceImages(QList<PerformanceImage> data)
	{
		m_PerformanceImages = data;
	}
	void C3fdReportData::addPerformanceImage(PerformanceImage data) { m_PerformanceImages.push_back(data); }
	void C3fdReportData::addPerformanceImage(QString name, QString img) {
		PerformanceImage data;
		data.name = name;
		data.img = img;
		m_PerformanceImages.push_back(data);
	}
	QList<FlowImage> C3fdReportData::getFlowImages() { return m_FlowImages; }
	void C3fdReportData::setFlowImages(QList<FlowImage> data)
	{
		m_FlowImages = data;
	}
	void C3fdReportData::addFlowImage(FlowImage data) { m_FlowImages.push_back(data); }
	void C3fdReportData::addFlowImage(QString name, QString img) {
		FlowImage data;
		data.name = name;
		data.img = img;
		m_FlowImages.push_back(data);
	}
}
